import require from '@/utils/_require';

const API = {
  'GETMENUAll': '/admin/acl/permission',
  'SAVEMENU': '/admin/acl/permission/save',
  'UPDATEMENU': '/admin/acl/permission/update',
  'DELETEMENU': '/admin/acl/permission/remove',
}

// 获取全部权限
export const reqGetMenuAll = function () {
  return require({
    url: API.GETMENUAll,
    method: 'get',
  })
}

// 保存权限
export const reqSaveMenu = function (data) {
  if (data.id) {
    return require({
      url: API.UPDATEMENU,
      method: 'put',
      data
    })
  } else {
    return require({
      url: API.SAVEMENU,
      method: 'post',
      data
    })
  }
}

// 删除权限
export const reqDeleteMenuById = function (id) {
  return require({
    url: API.DELETEMENU + `/${id}`,
    method: 'delete',
  })
}
